package com.dyp.been.web;

import com.dyp.been.service.MessageProcessor;
import com.dyp.been.service.SpringBeanProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

@RestController
public class TestResource {
    @Autowired
    MessageProcessor messageProcessor;

    @Autowired
    SpringBeanProvider springBeanProvider;
    @GetMapping("/test")
    public ResponseEntity<String> getTest(){
        return  ResponseEntity.ok().body(messageProcessor.toString());
    }

    @GetMapping("/test2")
    public ResponseEntity<String> getTest1(){
        return  ResponseEntity.ok().body(springBeanProvider.getBean(MessageProcessor.class).toString());
    }

}
